#ifndef AER_HEIGHTMAP_HPP_
#define AER_HEIGHTMAP_HPP_

#include "../aerDefs.hpp"


namespace aer {

///
/// Utility class to build a heightmap
/// [Warning : attributes are invalid when tesselation is used]
///
class Heightmap
{
  public:
    struct HMVertex
    {
      Vector3 position;
      Vector3 normal;
      Vector3 binormal;
      Vector3 tangent;
      Vector2 texcoord;
    };
  
  
  private:
    HMVertex *m_vertices;
    U32 m_width;
    U32 m_height;
  
  
  public:
    Heightmap();
    ~Heightmap();
       
    bool generate(const U32 width, const U32 height, const Vector3 &scales);
    
    float getLocationHeight(const Vector2 &location) const;
    
    const HMVertex* getVertices() const { return m_vertices; }
    const U32 getWidth() const { return m_width; }
    const U32 getHeight() const {return m_height; }
    
    
  private:
    void computeNBT();
};

} // aer

#endif //AER_HEIGHTMAP_HPP_
